package com.demo2do.fms.admin.service.supplier.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.fms.admin.dao.supplier.SupplierProfileDao;
import com.demo2do.fms.admin.service.DataServiceImpl;
import com.demo2do.fms.admin.service.supplier.SupplierParkingResourceService;
import com.demo2do.fms.entity.supplier.common.Supplier;
import com.demo2do.fms.entity.supplier.common.SupplierParkingResource;

/**
 * 
 * @author Wy
 *
 */
@Service("supplierParkingResourceService")
public class SupplierParkingResourceServiceImpl extends DataServiceImpl<SupplierParkingResource> implements SupplierParkingResourceService{

    @Dao
    private SupplierProfileDao supplierParkingResourceDao;

    /*
     * (non-Javadoc)
     * @see com.demo2do.fms.admin.service.supplier.SupplierParkingResourceService#listSupplierParkingResource(java.lang.Long)
     */
    public List<SupplierParkingResource> listSupplierParkingResource(Long supplierId) {
        
        return supplierParkingResourceDao.listSupplierParkingResource(supplierId);
    }

    /*
     * (non-Javadoc)
     * @see com.demo2do.fms.admin.service.supplier.SupplierParkingResourceService#create(com.demo2do.fms.entity.supplier.SupplierParkingResource)
     */
    public void create(SupplierParkingResource supplierParkingResource) {
        
        genericDaoSupport.save(supplierParkingResource.create());
        
    }

    /*
     * (non-Javadoc)
     * @see com.demo2do.fms.admin.service.supplier.SupplierParkingResourceService#edit(com.demo2do.fms.entity.supplier.SupplierParkingResource)
     */
    public void edit(SupplierParkingResource supplierParkingResource) {
        
        genericDaoSupport.update(supplierParkingResource.edit());
        
    }

    /*
     * (non-Javadoc)
     * @see com.demo2do.fms.admin.service.supplier.SupplierParkingResourceService#delete(com.demo2do.fms.entity.supplier.SupplierParkingResource)
     */
    public void delete(SupplierParkingResource supplierParkingResource) {
        
        genericDaoSupport.update(supplierParkingResource.delete());
        
    }

    /*
 * (non-Javadoc)
 * @see com.demo2do.fms.admin.service.supplier.SupplierParkingResourceService#create(java.lang.Long)
 */
    public void create(Long id) {
        
        Supplier supplier = genericDaoSupport.load(Supplier.class, id);
        
        SupplierParkingResource supplierParkingResource = new SupplierParkingResource(supplier);
        
        genericDaoSupport.save(supplierParkingResource.create());
    }

    
    
}
